﻿using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.ComponentModel;
using COFE.Core;

namespace COFE.Core
{
    /// <summary>
    /// Represent a directory in filesystem, allows creating, moving and enumerating child contents.
    /// A number of extension methods is implemented by IDirectoryInfoExAExtension.
    /// </summary>
    public interface IDirectoryInfo : IFileSystemInfo, IDirectoryNotifyFileSystemChanged
    {
        new IInternalDirectoryInfoExA InternalProperties { get; }

        /// <summary>
        /// Gets the root directory of the current directory.
        /// </summary>
        IDirectoryInfo Root { get; }

        /// <summary>
        /// Gets whether current directory has subfolders.
        /// </summary>
        bool HasSubFolder { get; }

        /// <summary>
        /// Gets whether current directory has files.
        /// </summary>
        bool HasFiles { get; }

        /// <summary>
        /// Gets the directory type of current directory.
        /// </summary>
        DirectoryTypeEnum DirectoryType { get; }

        /// <summary>
        /// Move current directory and it's contents to the specified path.
        /// </summary>
        /// <param name="destDirName">The name and path to which to move this directory.</param>
        void MoveTo(string destDirName);
        
        /// <summary>
        /// Create subdirectory.
        /// </summary>
        /// <param name="dirName"></param>
        /// <returns></returns>
        IDirectoryInfo CreateDirectory(string dirName);

        /// <summary>
        /// Create special directory using SecondaryDirectoryLister.
        /// </summary>
        /// <param name="dirName"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        IDirectoryInfo CreateVirtualDirectory(string dirName, string type);       
        
        /// <summary>
        /// Lookup an entries using filename.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="isFile"></param>
        /// <returns></returns>
        IFileSystemInfo this[string name, bool isFile] { get; }

        /// <summary>
        /// Lookup a directory using filename.
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        IDirectoryInfo this[string name] { get; }


        ///// <summary>
        ///// Return a enumerable of entries in current directory that match the search filterStr and search options.
        ///// </summary>
        ///// <param name="searchPattern"></param>
        ///// <param name="searchOption"></param>
        ///// <returns></returns>
        //IEnumerable<IFileSystemInfo> EnumerateFileSystemInfos(string searchPattern, SearchOptionEx searchOption);


        ///// <summary>
        ///// Return a enumerable of files in current directory that match the search filterStr and search options.
        ///// </summary>
        ///// <param name="searchPattern"></param>
        ///// <param name="searchOption"></param>
        ///// <returns></returns>
        //IEnumerable<IFileInfo> EnumerateFiles(string searchPattern, SearchOptionEx searchOption);

        ///// <summary>
        ///// Return a enumerable of directories in current directory that match the search filterStr and search options.
        ///// </summary>
        ///// <param name="searchPattern"></param>
        ///// <param name="searchOption"></param>
        ///// <returns></returns>
        //IEnumerable<IDirectoryInfo> EnumerateDirectories(string searchPattern, SearchOptionEx searchOption);
        
    }
}
